/*
 * Vec3D.h
 *
 *  Created on: Jun 24, 2012
 *      Author: burek
 */

#ifndef VEC3D_H_
#define VEC3D_H_

struct Vec3D
{
    float X, Y, Z;

    Vec3D( void );
    Vec3D( const float x, const float y, const float z );

    Vec3D& operator= ( const Vec3D& A );
    bool operator== ( const Vec3D& A ) const;
    bool operator!= ( const Vec3D& A ) const;
    Vec3D operator+ ( const Vec3D& A ) const;
    Vec3D operator- ( const Vec3D& A ) const;
    Vec3D operator* ( const Vec3D& A ) const;
    Vec3D operator/ ( const Vec3D& A ) const;
    Vec3D operator* ( const float A ) const;
    Vec3D operator/ ( const float A ) const;
    float dot( const Vec3D& A ) const;
    float length( void ) const;
    float lengthSquared( void ) const;
    void set(float x, float y, float z);
    Vec3D cross(const Vec3D & vec) const;
    Vec3D normalize(void) const;
    float distanceTo(const Vec3D& A) const;
    float distanceSquared(const Vec3D& A) const;


    void normalizeIP(void);
    void operator+= ( const Vec3D& A );
    void operator*= ( const Vec3D& A );
    void operator/= ( const Vec3D& A );
    void operator-= ( const Vec3D& A );
    void operator*= ( const float A );
    void operator/= ( const float A );
    void transform(const float matrix[]);
    void lerpIP( const Vec3D& A, const float x );
    Vec3D lerp( const Vec3D& A, const float x ) const;

    static Vec3D fromYawPitchRad(float yaw, float pitch);
    static Vec3D fromYawPitchDeg(float yaw, float pitch);
    static Vec3D fromHex(unsigned int hexa);

    static const Vec3D Zero;
    static const Vec3D One;

    static const Vec3D XUnit;
    static const Vec3D YUnit;
    static const Vec3D ZUnit;

    static const Vec3D NegXUnit;
    static const Vec3D NegYUnit;
    static const Vec3D NegZUnit;
};

#endif /* VEC3D_H_ */
